home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / dev / cross / caz.lha / caz / caz.h < prev    next >
C/C++ Source or Header  |  1993-05-17  |  5KB  |  190 lines

  1. #define MAXLABEL 32
  2. #define MAXDIRECTIVE MAXLABEL
  3. #define MAXCMD    5
  4. #define MAXOBCODE 0xFFFF
  5. #define NEWITEMOFF 5        /* should be greater in future (64) */
  6. #define MAXBYTESIH 16        /* maximum of Data Bytes in any INTELHEX row */
  7.  
  8. #define FILL_CHAR 0xff        /* character to fill DEFS space */
  9.  
  10. #define MAX(a,b) ((a)>(b)?(a):(b))
  11. #define MIN(a,b) ((a)<(b)?(a):(b))
  12. #define ABS(x) ((x<0)?(-(x)):(x))
  13.  
  14. #define ERROR -1
  15. #define SERIOUS -2
  16. #define TRUE 1
  17. #define FALSE 0
  18.  
  19. #define RETURN_OK                0  /* No problems, success */
  20. #define RETURN_WARN                5  /* A warning only */
  21. #define RETURN_ERROR               10  /* Something wrong */
  22. #define RETURN_FAIL               20  /* Complete or severe failure*/
  23.  
  24. struct item_file
  25. {
  26.     struct item_file *prev;                        /* Previous Item */
  27.     char              filename[FILENAME_MAX];    /* Filename of pushed/poped File */
  28.     long              filepos;                    /* Absolute Filepostion (seek) */
  29.     long              lnr;                        /* Actual linenumber in this file */
  30. };
  31.  
  32. struct labelitem
  33. {
  34.     u_short     value;
  35.     BOOL    valid;
  36.     int        type;
  37.     char    name[MAXLABEL+1];
  38. };
  39.  
  40. struct listheader
  41. {
  42.     int        nitem;        /* Total number of item's in list */
  43.     int        actitem;    /* Next/First unused item */
  44.     int        sizeitem;    /* Size of one item */
  45.     int        newnitem;    /* Size of list to small ? => Alloc 'n' new items */
  46.     int     userdata;    /* until yet not used */
  47.     void    *list;        /* data */
  48. };
  49.  
  50. /* Note: Size of Objectcode is 'lastbyte-firstbyte', so unfilled ranges
  51.          generated with 'ORG' directives are also counted.
  52.          To get actual 'objbuffer' address you must always subtract 'firstbyte' !
  53. */         
  54. struct objsize
  55. {
  56.     int        firstbyte;  /* Start address of used Range */
  57.     int        actbyte;    /* Actual address */
  58.     int        lastbyte;    /* End address */
  59.     u_char  *objbuffer;    /* Pointer to object buffer */
  60. };
  61.  
  62. #define OBJADABS    1    /* set Object Adress absolute */
  63. #define OBJADREL    2    /* set Object Adress relativ */
  64.  
  65. /* Label Types */
  66. #define L_EQU        1    /* directive type : EQU, constant declaration */
  67. #define L_DEFL        2    /* directive type : EQU, constant declaration */
  68. #define L_POSITION    3    /* directive type : Adress/Memory assignment */
  69.  
  70. #define PARSE1        1    /* flag */
  71. #define PARSE2        2
  72.  
  73. #define ORG          0            /* */
  74. #define EQU          L_EQU        /* */
  75. #define DEFL         L_DEFL        /* */
  76. #define DEFB         3            /* */
  77. #define DEFW         4                /* */
  78. #define DEFS         5           /* */
  79. #define DEFM         6            /* */
  80. #define INCLUDE     7
  81. #define END            8
  82. #define LIST        9
  83. #define LIST_OFF    10
  84. #define LIST_ON        11
  85. #define COND        12
  86. #define ENDC        13
  87. #define EJECT        14
  88. #define MACLIST        15
  89. #define HEADING        16
  90. #define MACRO        17
  91. #define ENDM        18
  92.  
  93. /*
  94.  *    Definitions for Commands
  95.  */
  96.  
  97. #define BRA_Z        0x00000001
  98. #define BRA_NZ        0x00000002    
  99. #define BRA_C        0x00000004    /* same as REG_C */    
  100. #define BRA_NC        0x00000008    
  101. #define BRA_PO        0x00000010            
  102. #define BRA_PE        0x00000020            
  103. #define BRA_P        0x00000040        
  104. #define BRA_M         0x00000080        
  105.  
  106. #define REG_A        0x00000001    
  107. #define REG_B        0x00000002
  108. #define REG_C        0x00000004    /* same as BRA_C */
  109. #define REG_D        0x00000008
  110. #define REG_E        0x00000010
  111. #define REG_F        0x00000020
  112. #define REG_H        0x00000040
  113. #define REG_I        0x00000080
  114. #define REG_L        0x00000100
  115. #define REG_R        0x00000200
  116. #define REG_AF        0x00000400
  117. #define REG_BC        0x00000800    
  118. #define REG_DE        0x00001000    
  119. #define REG_HL        0x00002000
  120. #define REG_SP        0x00004000
  121. #define REG_IX        0x00008000
  122. #define REG_IY        0x00010000
  123.  
  124. #define BRA            0x00020000    /* Mne makes a branch (means flags) */
  125. #define NBR            0x00040000    /* Mne uses all other than branches */
  126. #define OFF            0x00080000
  127. #define IND            0x00100000    /* Indirekt Adressing */    
  128. #define    IMODE0        0x00200000    /* works together with UNM3 */
  129. #define    IMODE1        0x00400000    /* works together with UNM3 */
  130. #define    IMODE2        (IMODE0|IMODE1)    /* works together with UNM3 */
  131.  
  132. #define EXMASK        (IND|IMODE2|OFF|NBR|BRA) /* Bits with must be equivalent with argument */
  133.  
  134. #define RST            0x04000000    /* only for RST Mnemomic */
  135. #define JMPREL        0x08000000    /* Jump Offset must be relativ to current position */
  136. #define UNM3        0x10000000    
  137. #define UNM8        0x20000000
  138. #define UNM16        0x40000000    
  139.  
  140. #define NOPAR        0x80000000
  141.  
  142. #define REG8         (REG_A|REG_B|REG_C|REG_D|REG_E|REG_H|REG_L)
  143. #define REG16         (REG_BC|REG_DE|REG_HL|REG_SP)
  144. #define REG            (REG8|REG16|REG_F|REG_I|REG_R|REG_AF|REG_IX|REG_IY)
  145. #define BRANCH4        (BRA_NZ|BRA_Z|BRA_NC|BRA_C)
  146. #define BRANCH8        (BRANCH4|BRA_PO|BRA_PE|BRA_P|BRA_M)
  147. #define UNM            (UNM3|UNM8|UNM16)
  148.  
  149. #define BYTE1        0x00
  150. #define BYTE2        0x01
  151. #define BYTE3        0x02
  152. #define BYTE4        0x03
  153.  
  154. #define BYTE(A)        ((A)&0x03)
  155.  
  156. #define BIT0        0x00
  157. #define BIT1        0x04
  158. #define BIT2        0x08
  159. #define BIT3        0x0C
  160. #define BIT4        0x10
  161. #define BIT5        0x14
  162. #define BIT6        0x18
  163. #define BIT7        0x1C
  164.  
  165. #define BIT(A)        (((A)&0x1C)>>2)
  166.  
  167. #define MNELE1        0x00    /* Length of the Mnemomic */
  168. #define MNELE2        0x20
  169. #define MNELE3        0x40
  170. #define MNELE4        0x60
  171.  
  172. #define MNELEN(A)    ((((A)&0x60)>>5)+1)
  173.  
  174. #define NOE            0x80
  175.  
  176. #define LOBYTE(A)    ((u_char)(A))    
  177. #define HIBYTE(A)    ((u_char)((A)>>8))
  178.  
  179. struct command 
  180. {
  181.     char     *name;        /* name of Mnemomic */
  182.     u_long     pa1,        /* first Parameter */
  183.             pa2;        /* second Parameter */
  184.     u_char    order1,        /* 0,1:Byte Nr / 2,3,4:Bit position/ 5,6:Mnemomic Length */
  185.             order2;        /* 0,1:Byte Nr / 2,3,4:Bit position */
  186.     u_char     obj[4];        /* Object Code */
  187.     u_short    cycle;        /* Number of Clock Cycles */
  188. };
  189.  
  190.